package com.xudu.controller.impl;


import com.xudu.common.Result;
import com.xudu.controller.ILogController;
import com.xudu.entity.Log;
import com.xudu.service.ILogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xudu
 * @since 2024-04-20
 */
@RestController
@RequestMapping("/log")
public class LogControllerImpl implements ILogController {

    @Autowired
    private ILogService iLogService;

    @Override
    public Result add(Log log) {
        iLogService.saveOrUpdate(log);
        return Result.success(log);
    }

    @Override
    public Result delete(int id) {
        iLogService.removeById(id);
        return Result.success();
    }

    @Override
    public Result update(Log log) {
        iLogService.saveOrUpdate(log);
        return null;
    }

    @Override
    public Result getAll() {
        List<Log> list = iLogService.list();

        return Result.success(list);
    }
}
